﻿using FrameworkCore.Data;
using Microsoft.EntityFrameworkCore;
using Application.Commons.Extensions;
using System.Reflection;
using FrameworkCore.Migrations.Data;

namespace Application.Commons.Data;

public partial class EfCoreDbContext : HookingDbContext
{
    public EfCoreDbContext(DbContextOptions options) : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
        builder.ApplyGlobalFilters<ISoftDeletedEntity>(s => !(s.IsDeleted == true));
    }
}
